package com.lesent.kafka.common;

import com.alibaba.fastjson.JSON;

/**
 * @author shengtao
 * @Description:
 * @date 2018/12/19 16:18
 */
public class JsonHelper {

    public static String obj2Json(Object obj) {
        if (obj != null) {
            return JSON.toJSONString(obj);
        }
        return null;
    }


    public static <T> T json2Obj(String json, Class<T> clazz) {
        return JSON.parseObject(json, clazz);
    }

}

